﻿using System.Data.Common;
using System.Data.Entity;
using Abp.Zero.EntityFramework;
using LeadThing.AbpZeroTemplate.Authorization.Roles;
using LeadThing.AbpZeroTemplate.Authorization.Users;
using LeadThing.AbpZeroTemplate.Chat;
using LeadThing.AbpZeroTemplate.Friendships;
using LeadThing.AbpZeroTemplate.MultiTenancy;
using LeadThing.AbpZeroTemplate.Storage;
using LeadThing.AbpZeroTemplate.BasicPersons;
using LeadThing.AbpZeroTemplate.BasicPersons.EntityMapper.BasicPersons;
using LeadThing.AbpZeroTemplate.SpecialPersons;
using LeadThing.AbpZeroTemplate.SpecialPersons.EntityMapper.SpecialPersons;
using LeadThing.AbpZeroTemplate.PersonTypes;
using LeadThing.AbpZeroTemplate.PersonTypes.EntityMapper.PersonTypes;
using LeadThing.AbpZeroTemplate.Areas;
using LeadThing.AbpZeroTemplate.Areas.EntityMapper.Areas;
using LeadThing.AbpZeroTemplate.GridPersons;
using LeadThing.AbpZeroTemplate.GridPersons.EntityMapper.GridPersons;
using LeadThing.AbpZeroTemplate.DisputeInformations;
using LeadThing.AbpZeroTemplate.DisputeTypes;
using LeadThing.AbpZeroTemplate.DisputeTypes.EntityMapper.DisputeTypes;
using LeadThing.AbpZeroTemplate.Files;
using LeadThing.AbpZeroTemplate.Files.EntityMapper.Files;
using LeadThing.AbpZeroTemplate.DisputeInformations.EntityMapper.DisputeInformations;
using LeadThing.AbpZeroTemplate.CaseCategorys;
using LeadThing.AbpZeroTemplate.WorkFlow_TableNames;
using LeadThing.AbpZeroTemplate.WorkFlow_TableNames.EntityMapper.WorkFlow_TableNames;
using LeadThing.AbpZeroTemplate.CaseCategorys.EntityMapper.CaseCategorys;
using LeadThing.AbpZeroTemplate.WorkFlows;
using LeadThing.AbpZeroTemplate.WorkFlows.EntityMapper.WorkFlows;
using LeadThing.AbpZeroTemplate.WorkFlow_Processs;
using LeadThing.AbpZeroTemplate.WorkFlow_Processs.EntityMapper.WorkFlow_Processs;
using LeadThing.AbpZeroTemplate.WorkFlow_Runs;
using LeadThing.AbpZeroTemplate.WorkFlow_Runs.EntityMapper.WorkFlow_Runs;
using LeadThing.AbpZeroTemplate.WorkFlow_Run_Processs;
using LeadThing.AbpZeroTemplate.WorkFlow_Run_Processs.EntityMapper.WorkFlow_Run_Processs;
using LeadThing.AbpZeroTemplate.SupportingSystems;
using LeadThing.AbpZeroTemplate.SupportingSystems.EntityMapper.SupportingSystems;
using LeadThing.AbpZeroTemplate.AssessmentReports;
using LeadThing.AbpZeroTemplate.AssessmentReports.EntityMapper.AssessmentReports;
using LeadThing.AbpZeroTemplate.ProjectStatuss;
using LeadThing.AbpZeroTemplate.ProjectStatuss.EntityMapper.ProjectStatuss;
using LeadThing.AbpZeroTemplate.CallPolices;
using LeadThing.AbpZeroTemplate.CallPolices.EntityMapper.CallPolices;
using LeadThing.AbpZeroTemplate.CallTypes;
using LeadThing.AbpZeroTemplate.CallTypes.EntityMapper.CallTypes;
using LeadThing.AbpZeroTemplate.LawsRegulationses;
using LeadThing.AbpZeroTemplate.LawsRegulationses.EntityMapper.LawsRegulationses;
using LeadThing.AbpZeroTemplate.ArticleCategorys;
using LeadThing.AbpZeroTemplate.ArticleCategorys.EntityMapper.ArticleCategorys;
using LeadThing.AbpZeroTemplate.Articles;
using LeadThing.AbpZeroTemplate.Articles.EntityMapper.Articles;
using LeadThing.AbpZeroTemplate.VersionApps;
using LeadThing.AbpZeroTemplate.VersionApps.EntityMapper.VersionApps;
using LeadThing.AbpZeroTemplate.CommandDispatches;
using LeadThing.AbpZeroTemplate.CommandDispatches.EntityMapper.CommandDispatches;
using LeadThing.AbpZeroTemplate.VideoReceiverses;
using LeadThing.AbpZeroTemplate.VideoReceiverses.EntityMapper.VideoReceiverses;
using LeadThing.AbpZeroTemplate.CameraManages;
using LeadThing.AbpZeroTemplate.CameraManages.EntityMapper.CameraManages;
using LeadThing.AbpZeroTemplate.UserMeetingRefs;
using LeadThing.AbpZeroTemplate.UserMeetingRefs.EntityMapper.UserMeetingRefs;
using LeadThing.AbpZeroTemplate.FireFightingWorks;
using LeadThing.AbpZeroTemplate.FireFightingWorks.EntityMapper.FireFightingWorks;
using LeadThing.AbpZeroTemplate.UserTrajectories;
using LeadThing.AbpZeroTemplate.UserTrajectorys.EntityMapper.UserTrajectorys;

namespace LeadThing.AbpZeroTemplate.EntityFramework
{
    /* Constructors of this DbContext is important and each one has it's own use case.
     * - Default constructor is used by EF tooling on design time.
     * - constructor(nameOrConnectionString) is used by ABP on runtime.
     * - constructor(existingConnection) is used by unit tests.
     * - constructor(existingConnection,contextOwnsConnection) can be used by ABP if DbContextEfTransactionStrategy is used.
     * See http://www.aspnetboilerplate.com/Pages/Documents/EntityFramework-Integration for more.
     */

    public class AbpZeroTemplateDbContext : AbpZeroDbContext<Tenant, Role, User>
    {
        /* Define an IDbSet for each entity of the application */

        public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }
        public virtual IDbSet<Friendship> Friendships { get; set; }
        public virtual IDbSet<ChatMessage> ChatMessages { get; set; }

        #region 自定义
        public IDbSet<BasicPerson> BasicPersons { get; set; }
        public IDbSet<SpecialPerson> SpecialPersons { get; set; }
        public IDbSet<PersonType> PersonTypes { get; set; }
        public IDbSet<Area> Areas { get; set; }
        public IDbSet<GridPerson> GridPersons { get; set; }
        public IDbSet<DisputeType> DisputeTypes { get; set; }
        public IDbSet<File> Files { get; set; }
        public IDbSet<DisputeInformation> DisputeInformations { get; set; }
        public IDbSet<WorkFlow_TableName> WorkFlow_TableNames { get; set; }
        public IDbSet<CaseCategory> CaseCategorys { get; set; }
        public IDbSet<WorkFlow> WorkFlows { get; set; }
        public IDbSet<WorkFlow_Process> WorkFlow_Processs { get; set; }
        public IDbSet<WorkFlow_Run> WorkFlow_Runs { get; set; }
        public IDbSet<WorkFlow_Run_Process> WorkFlow_Run_Processs { get; set; }
        public IDbSet<SupportingSystem> SupportingSystems { get; set; }
        public IDbSet<AssessmentReport> AssessmentReports { get; set; }
        public IDbSet<ProjectStatus> ProjectStatuss { get; set; }
        public IDbSet<CallPolice> CallPolices { get; set; }
        public IDbSet<CallType> CallTypes { get; set; }
        public IDbSet<LawsRegulations> LawsRegulationss { get; set; }
        public IDbSet<ArticleCategory> ArticleCategorys { get; set; }
        public IDbSet<Article> Articles { get; set; }
        public IDbSet<VersionApp> VersionApps { get; set; }
        public IDbSet<CommandDispatch> CommandDispatchs { get; set; }
        public IDbSet<VideoReceivers> VideoReceiverss { get; set; }
        public IDbSet<CameraManage> CameraManages { get; set; }
        public IDbSet<UserMeetingRef> UserMeetingRefs { get; set; }
        public IDbSet<FireFightingWork> FireFightingWorks { get; set; }

        public IDbSet<UserTrajectory> UserTrajectorys { get; set; }
        





        #endregion


        public AbpZeroTemplateDbContext()
            : base("Default")
        {

        }

        public AbpZeroTemplateDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        public AbpZeroTemplateDbContext(DbConnection existingConnection)
           : base(existingConnection, false)
        {

        }

        public AbpZeroTemplateDbContext(DbConnection existingConnection, bool contextOwnsConnection)
            : base(existingConnection, contextOwnsConnection)
        {

        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            #region 自定义

            modelBuilder.Configurations.Add(new BasicPersonCfg());
            modelBuilder.Configurations.Add(new SpecialPersonCfg());
            modelBuilder.Configurations.Add(new PersonTypeCfg());
            modelBuilder.Configurations.Add(new AreaCfg());
            modelBuilder.Configurations.Add(new GridPersonCfg());
            modelBuilder.Configurations.Add(new DisputeTypeCfg());
            modelBuilder.Configurations.Add(new FileCfg());
            modelBuilder.Configurations.Add(new DisputeInformationCfg());
            modelBuilder.Configurations.Add(new WorkFlow_TableNameCfg());
            modelBuilder.Configurations.Add(new CaseCategoryCfg());
            modelBuilder.Configurations.Add(new WorkFlowCfg());
            modelBuilder.Configurations.Add(new WorkFlow_ProcessCfg());
            modelBuilder.Configurations.Add(new WorkFlow_RunCfg());
            modelBuilder.Configurations.Add(new WorkFlow_Run_ProcessCfg());
            modelBuilder.Configurations.Add(new SupportingSystemCfg());
            modelBuilder.Configurations.Add(new AssessmentReportCfg());
            modelBuilder.Configurations.Add(new ProjectStatusCfg());
            modelBuilder.Configurations.Add(new CallPoliceCfg());
            modelBuilder.Configurations.Add(new CallTypeCfg());
            modelBuilder.Configurations.Add(new LawsRegulationsCfg());
            modelBuilder.Configurations.Add(new ArticleCategoryCfg());
            modelBuilder.Configurations.Add(new ArticleCfg());
            modelBuilder.Configurations.Add(new VersionAppCfg());
            modelBuilder.Configurations.Add(new CommandDispatchCfg());
            modelBuilder.Configurations.Add(new VideoReceiversCfg());
            modelBuilder.Configurations.Add(new CameraManageCfg());
            modelBuilder.Configurations.Add(new UserMeetingRefCfg());
            modelBuilder.Configurations.Add(new FireFightingWorkCfg());
            modelBuilder.Configurations.Add(new UserTrajectoryCfg());

            #endregion
            base.OnModelCreating(modelBuilder);
        }
    }
}
